import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long x1 = scanner.nextLong();
        long y1 = scanner.nextLong();
        long x2 = scanner.nextLong();
        long y2 = scanner.nextLong();

        long x3 = scanner.nextLong();
        long y3 = scanner.nextLong();
        long x4 = scanner.nextLong();
        long y4 = scanner.nextLong();

        //保证R1矩形在左侧
        if(x3 < x1) {
            long t = x1;    x1 = x3;            x3 = t;
            t = y1;        y1 = y3;            y3 = t;
            t = x2;        x2 = x4;            x4 = t;
            t = y2;        y2 = y4;            y4 = t;
        }

        long sum = 0;
        sum += (x2-x1) * (y2-y1);
        sum += (x4-x3) * (y4-y3);

        long copy = 0;
        long a = x3;
        long b = Math.max(y1,y3);
        long c = Math.min(x2,x4);
        long d = Math.min(y2,y4);
        if(a<=x2 && d>=y1) {
            copy = (c-a) * (d-b);
        }

        System.out.println(sum - copy);
    }
}
